#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: client.py 
@version:
@time: 2022/06/22 
"""
import socket
import time

MaxBytes = 1024 * 1024
serve_address = ('127.0.0.1', 11223)

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.settimeout(30)
client.connect_ex(serve_address)

try:
    while True:
        input_data = input()  # 等待输入数据
        if input_data == "quit":
            print("quit")
            break
        sendBytes = client.send(input_data.encode())
        if sendBytes <= 0:
            continue
except Exception as e:
    print(e)
finally:
    client.close()
    print("exit")
